package com.zijie.shop.order.api.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zijie.order.model.Order;
import com.zijie.order.model.search.OrderSearchBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {
    default Page<Order> findAll(Page<Order> page, OrderSearchBean osb){
        LambdaQueryWrapper<Order> queryWrapper = Wrappers.lambdaQuery(osb);
        return this.selectPage(page,queryWrapper);
    }
    @Update("update `order` set status = '2' where id = #{id}")
    boolean updateStatusToFaHuo(Integer id);
    @Update("update `order` set status = '3' where id = #{id}")
    boolean updateStatusToSongDa(Integer id);
    @Update("update `order` set pay_type = #{payType},status=#{status} where order_no = #{orderNo}")
    boolean updateByIdUser(Order order);
}